import React from 'react'
import '@/views/Card.scss'
import Pt from 'prop-types'
export default function Card(props) {
  return (
    <div className='box'>
        <div>
            <img src={props.avatar} alt="" className='avatar'/>
        </div>
        <div className='title'>
          <span>{props.name}</span>
        </div>
        <div className='desc'>
          <div>{props.age}岁</div>
          <div>{props.major}</div>
          <button onClick={()=>{
            props.browserInfo(props.name)
          }}>浏览</button>
        </div>
    </div>
  )
}
/**
 * 默认值的语法
 * 函数名.defaultProps
 */
Card.defaultProps={
  avatar:'http://img.touxiangwu.com/zb_users/upload/2023/04/202304061680747835345417.jpg'
}
/**
 * 验证器的写法
 */
Card.propTypes={
  age:Pt.number.isRequired
}